package dynamic;

import BranchBound.Task;
import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;

public class IntervalSchedulingTest {
    public static void main(String args[]) {
        //工作（起始时间，结束时间，权值）
        Task[] tasks = {
                new Task(0, 0, 0),
                new Task(2, 3, 50),
                new Task(4, 7, 8100),
                new Task(6, 7, 8000),
                new Task(8, 10, 50),
        };

        IntervalScheduling intervalScheduling = new IntervalScheduling();

        int[] position = intervalScheduling.interval(tasks);
        int[][] result = intervalScheduling.solve(tasks, position);

        display(tasks.length, result);
    }

    public static void display(int size, int[][] result) {
        for (int i = size - 1; i > 0; i = result[i][1]) {
            if (result[i][0] == 1) {
                System.out.println("工作 " + i);
            }
        }
    }
}
